#ifndef _MYLOG4CPP_H
#define _MYLOG4CPP_H
#include <iostream>
#include<log4cpp/Category.hh>
#include <log4cpp/OstreamAppender.hh>
#include<log4cpp/Layout.hh>
#include <log4cpp/BasicLayout.hh>
#include<log4cpp/BasicLayout.hh>
#include <log4cpp/FileAppender.hh>
#include <log4cpp/Appender.hh>
#include <log4cpp/Priority.hh>
#include <log4cpp/PatternLayout.hh>
#include<log4cpp/RollingFileAppender.hh>
#include <log4cpp/PropertyConfigurator.hh>
#include<string>
using namespace std;
using namespace log4cpp;
class logger{
public:
    void debug(const char * file, int line, const char * func, const string msg);
    void info(const char * file, int line, const char * func, const string msg);
    void warn(const char * file, int line, const char * func, const string msg);
    void error(const char * file, int line, const char * func, const string msg);
    static logger * getInstance();
    static void destory();

private:
    logger();
    ~logger();
    logger(const logger &)=delete;
    logger & operator=(const logger&)=delete;
    static logger * _pInstance;
    static Category * _root;



};
#define LOG_WARN(msg) logger::getInstance()->warn(__FILE__,__LINE__,__FUNCTION__,msg)
#define LOG_ERROR(msg) logger::getInstance()->error(__FILE__,__LINE__,__FUNCTION__,msg)
#define LOG_DEBUG(msg) logger::getInstance()->debug(__FILE__,__LINE__,__FUNCTION__,msg)
#define LOG_INFO(msg) logger::getInstance()->info(__FILE__,__LINE__,__FUNCTION__,msg)


#endif //_MTLOG4CPP_h

